import React from 'react';
import { Tabs,Input } from 'antd';
import Editor from '@/utils/Editor';

const { TextArea } = Input;
const { TabPane } = Tabs;

class AnswerEdit extends React.Component{

  componentDidMount() {
    if (this.props.onRef){
      this.props.onRef(this);
    }
  }

  getRichTextContent = (index) => {
    const con = `content${index}`;
    if(con && this.refs[con]){
      return this.refs[con].getUeditorContent()
    }else {
      return ''
    }
  }

  render() {
    const { answer,index,checkTab,textChangeValue } = this.props;
    return (
      <div style={{marginTop:10}}>
        <Editor
          content={answer.content}
          name={`content${index}`}
          id={`content${index}`}
          ref={`content${index}`}
        />
        {/*<Tabs defaultActiveKey={answer.answerType} onChange={(key) => checkTab(key,index,answer.answerType)}>*/}
        {/*  <TabPane tab="富文本" key="richText">*/}
        {/*    <Editor*/}
        {/*      content={answer.content}*/}
        {/*      name={`content${index}`}*/}
        {/*      id={`content${index}`}*/}
        {/*      ref={`content${index}`}*/}
        {/*    />*/}
        {/*  </TabPane>*/}
        {/*  <TabPane tab="文本" key="text">*/}
        {/*    <TextArea*/}
        {/*      autoSize={{ minRows: 8, maxRows: 9 }}*/}
        {/*      value={answer.content}*/}
        {/*      maxLength={500}*/}
        {/*      onChange={(e) => textChangeValue(e,index)}*/}
        {/*    />*/}
        {/*  </TabPane>*/}
        {/*</Tabs>*/}
      </div>
    )
  }
}

export default AnswerEdit
